@{
    var CommentGrid = new WebGrid(source : Page.Comments, rowsPerPage:20);
}
@* admin comment list view *@
<h3>Comment list</3>
<div class="error">@Request.QueryString["ErrorMessage"]</div>
<div class="green">@Request.QueryString["SuccessMessage"]</div>
@if(Page.Comments.Count<=0){
    <div>No comments yet</div>
}else{
    
    @* comments  displayed with a WebGrid *@
    @CommentGrid.GetHtml( tableStyle:"grid", alternatingRowStyle:"alt",headerStyle:"head",columns:CommentGrid.Columns( 
        CommentGrid.Column( "ArticleTitle","Article title",format:@<text>@Utils.Trim(item.ArticleTitle,25,"...")</text>),
        CommentGrid.Column("author",format:@<text>@if(String.IsNullOrEmpty(item.DisplayName)){@item.author;}else{<b>registered user</b><br/>@item.DisplayName;}</text>),
        CommentGrid.Column( "title"),
        CommentGrid.Column( "message",format:@<div title="@item.message" >@Utils.Trim(item.message,50,"...")</div>),
        CommentGrid.Column( "email","email"),
        CommentGrid.Column( "creationDate","Date",format:@<div>@item.creationDate</div>),
        CommentGrid.Column( "id","Delete",format:@<a href="@Href("~/Actions/Admin/DeleteComment",item.id)">Delete</a>),
        CommentGrid.Column( "id","Delete",format:@<a href="@Href("~/Actions/Admin/PublishComment",item.id)">@(item.published>0?"Unpublish":"publish")</a>)
    ) );
    
}